Skip to content

feat: sync HTTP types and auth with Node SDK 2.2.0 - #35

Merged
suguanYang merged 2 commits into
mainfrom
feat/suguanYang/node-2.2-http-parity
Aug 24, 2026
Merged

feat: sync HTTP types and auth with Node SDK 2.2.0#35
suguanYang merged 2 commits into
mainfrom
feat/suguanYang/node-2.2-http-parity

Conversation

@suguanYang

Copy link
Copy Markdown
Collaborator

Summary

  • Align the Python SDK with Node 2.2.0 HTTP/type parity: document_metadata on job create/parse (official created_by_client=python-sdk / client_version defaults; caller keys win), planned document_id on Job create responses, and document_metadata on Document.
  • Add documents.get_page_citation_source and typed PageCitationAsset for chunk.metadata["pageAssets"]. The SDK does not generate citation assets.
  • Accept auth_token_provider for short-lived bearer tokens. A static api_key still wins; the provider is called per request.

Closes #34 for the P0 HTTP/type slice. Knowledge/parsed-storage (P1) is out of scope. Do not merge release PR #32 first — release-please should rewrite it so 2.0.0 includes these commits.

Test plan

  • uv run ruff check src/ tests/
  • uv run mypy src/knowhere
  • uv run pytest -q
  • Create a job with no document_metadata and confirm the body includes created_by_client=python-sdk and client_version
  • Override created_by_client and confirm the caller value wins
  • Confirm Job.document_id is populated when the API returns a planned id
  • Call documents.get_page_citation_source and confirm GET /v2/documents/{id}/files/page-citation-source
  • Construct Knowhere(auth_token_provider=...) without api_key and confirm the Authorization header refreshes per request

Made with Cursor

suguanYang and others added 2 commits August 24, 2026 22:11
Add document metadata telemetry, planned document_id on job create, page citation source helpers, and auth_token_provider so unpublished 2.0.0 can match Node HTTP/type parity.

Co-authored-by: Cursor <cursoragent@cursor.com>
CI has no lockfile, so uv sync pulled ruff 0.16 which fails on pre-existing Optional annotations. Cap the pin and sort the imports that 0.16 already flagged in this change.

Co-authored-by: Cursor <cursoragent@cursor.com>
@suguanYang
suguanYang merged commit d4706a9 into main Aug 24, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sync Python SDK with Node SDK 2.2.0

1 participant